package test2;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-04-01
 * Time: 15:01
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        String s = Integer.toBinaryString(num);
        int sl = s.length();
        int maxCount = 0;
        for (int i = 0; i < sl; i++) {
            int count = 0;
            while (i < sl && s.charAt(i) == '1') {
                count++;
                i++;
            }
            maxCount = Math.max(maxCount, count);
        }
        System.out.println(maxCount);
    }
}
